<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">   
    <meta name="viewport"        
        content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>投诉建议</title>
    <link rel="stylesheet" href="../public/css/footer.css">
    <link rel="stylesheet" href="../public/css/reset.css">
    <link rel="stylesheet" href="../public/css/all_use.css">
    <link rel="stylesheet" href="../public/css/tousu.css">
    <script src="../public/js/utils/utils.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.12/lib/index.css" />
    <script src="http://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <script src="https://cdn.bootcss.com/qs/6.7.0/qs.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6/dist/vue.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vant@2.12/lib/vant.min.js"></script>
</head>
<style>
</style>

<body>
    <div id="app">
        <div class="ts">投诉事由</div>
        <van-field style="background: #F3F3F4;" v-model="accuse" rows="1" show-word-limit maxlength="200"
            type="textarea" placeholder="请简要描述你遇到的问题和意见" autosize>
        </van-field>
        <div class="ts">图片上传</div>
        <div class="bj">
            <van-uploader :after-read="afterRead" accept="image/*" multiple>
                <img :src="picture" class="tp" >
            </van-uploader>
            <!-- <van-uploader :after-read="afterRead1" accept="image/*" multiple>
                <img src="../public/img/tj.png" class="tp" >
            </van-uploader>
            <van-uploader :after-read="afterRead2" accept="image/*" multiple>
                <img src="../public/img/tj.png" class="tp" >
            </van-uploader> -->
        </div>
        <div class="ts">联系电话</div>
        <input type="text" placeholder=" 选填，便于我们与你联系" v-model="number" class="dhk" maxlength="11"></input>
        <div class="tj">
            <div type="button" class="wz" @click="addComplaint1">提交</div>
        </div>
    </div>
</body>
<script type="module">
    import ajax from "../public/js/api/api.js";
    var app = new Vue({
        el: '#app',
        data: {
            text: '',
            accuse: '',
            number: '',
            picture:'../public/img/tj.png'
            // afterRead:''
        },
        created() {

        },
        methods: {
            addComplaint1() {
                ajax
                    .addComplaint({
                        accuse: this.accuse,
                        picture: this.picture,
                        number: this.number
                    })
                    .then((res) => {
                        if (res.data.code == 0) {

                        }
                    })
            },
            afterRead(file) {
                console.log(file, "----afterRead-----");
                const formData = new FormData();
                formData.append("file", file.file);// 获取上传图片信息   
                axios
                    .post("https://prepaidrefill.bjxkj.net.cn/api/upload/uploadImg", formData, {
                        headers: {
                            "content-type": "multipart/form-data",
                            // token: this.token,
                        },
                    })
                    .then((res) => {
                        if(res.data.code == 0){
                            this.picture=res.data.data
                            // console.log(res.data.data);   
                        }
                    });
            },
        }
    })
</script>

</html>